package com.seejoke.sharding;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author yangzhongying
 * @date 2020/4/27 11:26
 * @see com.seejoke.sharding.ShardingApplication
 */
@SpringBootApplication
@EnableAsync
@EnableScheduling
@EnableTransactionManagement
public class ShardingApplication {

  public static void main(String[] args) {
    SpringApplication.run(ShardingApplication.class, args);
  }

  @Bean
  public ConfigurableServletWebServerFactory configurableServletWebServerFactory() {
    TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
    factory.addConnectorCustomizers(
        (TomcatConnectorCustomizer)
            connector -> connector.setProperty("relaxedQueryChars", "|{}[]"));
    return factory;
  }
}
